<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=uft-8">
    
    <title>检验注册页面</title>
   

  </head>
 
  <body>
    <br>
   <%
   request.setCharacterEncoding("utf-8");
   String username=request.getParameter("username");
   String passwords=request.getParameter("pwd");
   String name=request.getParameter("name");
   String sex=request.getParameter("sex");
   String age=request.getParameter("age");
   String number=request.getParameter("number");
   %>
   <% 
   String driver = "com.mysql.jdbc.Driver";  
   String url = "jdbc:mysql://localhost:3306/jsp";  
   String use = "root";   
   String password = "root"; 
    Class.forName(driver);  
    Connection conn= DriverManager.getConnection(url,use,password);  
    PreparedStatement sql =conn.prepareStatement("insert into tb_student(username,passwords,name,sex,age,number)values(?,?,?,?,?,?)");
    sql.setString(1,username);
    sql.setString(2,passwords); 
    sql.setString(3,name);
    sql.setString(4,sex);
    sql.setString(5,age);
    sql.setString(6,number);
    int rtn=sql.executeUpdate();
    sql.close();
    conn.close();
    %>
    <jsp:forward page="registerSuccess.jsp" />
    </body>
</html>